package com.jzhao.control.model.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import javax.sql.DataSource;

import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.jzhao.control.model.RemoterAcc;
import com.jzhao.jpre.base.StringPublicDeal;
import com.jzhao.jpre.model.AcctFilter;

public class RemoterAccDao extends SimpleJdbcDaoSupport {
	//protected JdbcTemplate jdbcTemplate;
	protected StringPublicDeal strPubDeal;

//	public void setDataSource(DataSource dataSource) {
//		jdbcTemplate = new JdbcTemplate(dataSource);
//	}

	public void setStrPubDeal(StringPublicDeal strPubDeal) {
		this.strPubDeal = strPubDeal;
	}

	

	public RemoterAcc selectByAccId(String user_acc) throws DataAccessException {
		String sql = "select * from t_remoter_acc t where t.user_acc=?";
		try {
			return (RemoterAcc)getSimpleJdbcTemplate().queryForObject(sql,  
	                ParameterizedBeanPropertyRowMapper.newInstance(RemoterAcc.class), user_acc);  
		} catch (EmptyResultDataAccessException e) {
			// TODO Auto-generated catch block
			return null;
		}
	}
	
	 
}
